﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

public partial class UpdatePanelTest : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        // Uncomment to test slow postbacks.
        //if (IsPostBack)
        //    System.Threading.Thread.Sleep(TimeSpan.FromSeconds(10));


        // Uncomments to test error handling.
        //if (IsPostBack)
        //    throw new ApplicationException("This operation failed.");

      DateTime prevTime1, prevTime2, prevTime3;
      DateTime.TryParse(Label1.Text.ToString(), out prevTime1);
      DateTime.TryParse(Label2.Text.ToString(), out prevTime2);
      DateTime.TryParse(Label3.Text.ToString(), out prevTime3);

      DateTime now = DateTime.Now;
      int timeout1 = (int)Math.Round(now.Subtract(prevTime1).TotalSeconds);
      int timeout2 = (int)Math.Round(now.Subtract(prevTime2).TotalSeconds);
      int timeout3 = (int)Math.Round(now.Subtract(prevTime3).TotalSeconds);

        Label1.Text = DateTime.Now.ToLongTimeString();
        Label2.Text = DateTime.Now.ToLongTimeString();
        Label3.Text = DateTime.Now.ToLongTimeString();

        lblTimeout1.Text = timeout1.ToString();
        lblTimeout2.Text = timeout2.ToString();
        lblTimeout3.Text = timeout3.ToString();

    }
    
}
